import http from '@/utils/http'


export const getAnswerListAPI = (id, order) =>
  http.get(`/api/answer/list/${id}`, {
    params: { order }
  })

export const getUserAnswerListAPI = (id) => http.get(`/api/answer/user/${id}`)

export const addAnswerAPI = ({ questionId, content }) =>
  http.post('/api/answer', {
    questionId, content
  })

export const deleteAnswerAPI = (id) => http.delete(`/api/answer/${id}`)

export const updateAnswerAPI = ({ answerId, content, questionId }) =>
  http.put('/api/answer', {
    answerId, content, questionId
  })

export const acceptAnswerAPI = (answerId) =>
  http.put(`/sys/answer/accept/${answerId}`)

export const cancelAcceptAnswerAPI = (answerId) =>
  http.put(`/sys/answer/cancel/${answerId}`)